package com.example.leetcode.tree;

import com.example.leetcode.tree.common.TreeNode;
import com.example.leetcode.tree.common.TreeUtils;

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 * int val;
 * TreeNode left;
 * TreeNode right;
 * TreeNode() {}
 * TreeNode(int val) { this.val = val; }
 * TreeNode(int val, TreeNode left, TreeNode right) {
 * this.val = val;
 * this.left = left;
 * this.right = right;
 * }
 * }
 */
class Solution938 {
    public int rangeSumBST(TreeNode root, int low, int high) {
        return TreeUtils.rangeSumBST(root, low, high);
    }
}

public class leetcode938 {
    public static void main(String[] args) {
        Integer[] root = {10, 5, 15, 3, 7, null, 18};
        Solution938 solution938 = new Solution938();
        System.out.println(solution938.rangeSumBST(TreeUtils.generateLeetcodeTree(root), 7, 15));
    }
}
